package com.itcast.plane.modoule.ticket.service;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.itcast.plane.modoule.ticket.domain.Ticket;
import com.itcast.plane.modoule.ticket.dto.TicketCreatDTO;
import com.itcast.plane.modoule.ticket.mapper.TicketMapper;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

@Service
public class TicketService extends ServiceImpl<TicketMapper, Ticket> {

    @Resource
    private TicketMapper ticketMapper;

    public int addTicket(TicketCreatDTO ticketCreatDTO) {
        Ticket ticket = new Ticket();
        BeanUtils.copyProperties(ticketCreatDTO,ticket);
        ticketMapper.insert(ticket);
        return ticket.getId();
    }

    public void editTicket(Ticket ticket) {
        ticketMapper.updateById(ticket);
    }
}
